Emorie D Beck
From last week:
ggplot() and aes()
scale_x_continuous() and scale_fill_manual()
geom_point() and geom_line()
facet_wrap() and facet_grid()
theme_classic()
theme() (legend, strip, axis, plot, panel)# A tibble: 8 × 3
name rgb hex
<chr> <list> <chr>
1 black <dbl [3]> #000000
2 sky blue <dbl [3]> #56B4E9
3 bluish green <dbl [3]> #009E73
4 yellow <dbl [3]> #F0E442
5 orange <dbl [3]> #E69F00
6 blue <dbl [3]> #0072B2
7 vermillion <dbl [3]> #D55E00
8 reddish purple <dbl [3]> #CC79A7
# A tibble: 360,553 × 9
year SID marital chldbrth gender yearBrth mortality job age
<dbl> <dbl> <dbl> <dbl> <dbl+lbl> <dbl> <dbl> <dbl> <dbl>
1 1999 901 4 0 2 [[2] Female] 1951 0 NA 48
2 1999 1202 3 0 2 [[2] Female] 1913 0 NA 86
3 1999 1901 2 0 2 [[2] Female] 1948 0 NA 51
4 1999 2301 2 0 1 [[1] Male] 1946 0 NA 53
5 1999 2302 2 0 2 [[2] Female] 1946 0 NA 53
6 1999 2501 2 0 2 [[2] Female] 1924 0 NA 75
7 1999 2801 2 0 1 [[1] Male] 1947 0 NA 52
8 1999 2802 2 0 2 [[2] Female] 1956 0 NA 43
9 1999 910603 2 0 1 [[1] Male] 1959 0 NA 40
10 1999 2901 2 0 1 [[1] Male] 1932 0 NA 67
# … with 360,543 more rows
ggplot2 doesn’t specifically support pie chartscoord_polar()
geom_bar() + coord_polar()
We could label the bars, but let’s label the axes instead
We could label the bars, but let’s label the axes instead
Exercise: * Improve the colors by making them: + Colorblind-friendly + Match the goal of the plot (see title)
PSC 290 - Data Visualization